package com.wn.controller;

import com.wn.bean.R;
import org.springframework.web.bind.annotation.*;

/**
 * @author yellow Docter
 * @date 2022 -07-13
 * @desc
 */
@RestController
@RequestMapping("book")
public class BookController {

    @GetMapping("/test/{id}")
    public R get(@PathVariable Integer id){

        Object obj = null;
        if (id == 1){
            int i = 10 / 0;
        }
        if (id == 2){
            obj.toString();
        }
        return R.OK();
    }



    @DeleteMapping("/{id}")
    public String delete(@PathVariable Integer id){
        System.out.println("book delete..." + id);
        return "{'module':'book delete'}";
    }

    @GetMapping("/{id}")
    public String getById(@PathVariable Integer id){
        System.out.println("book getById..."+id);
        return "{'module':'book getById'}";
    }

    @GetMapping
    public String getAll(){
        System.out.println("book getAll...");
        return "{'module':'book getAll'}";
    }


}
